<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="./template/TCubeTemplate.xhtml">

    <ui:define name="contentInsert">
    <h:body>
        <h:form id="formMain">
            <h1>TCube Add Redemption List</h1>

            <p:panel id="panel" header="Create New RedemptionList">
                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" />
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value="" />
                    </f:facet>
                </p:ajaxStatus>
                <p:messages />
                <h:panelGrid columns="3" cellpadding="10" id="grid">
                    <h:outputLabel for="name" style="font-weight: bold" value="RedemptionList name: " />
                    <h:inputText required="true" label="Branch Name" requiredMessage="RedemptionList name is required." id="name" value="#{redemptionManagerBean.redemptionList.name}">
                    </h:inputText>
                    <p:message for="name" />

                    <h:outputLabel for="description" style="font-weight: bold" value="Description: " />
                    <p:inputTextarea required="true" label="Description" requiredMessage="Description is required." id="description" value="#{redemptionManagerBean.redemptionList.description}">
                    </p:inputTextarea>
                    <p:message for="description" />

                    <h:outputLabel for="maxQuantity" style="font-weight: bold" value="Max Quantity: " />
                    <h:inputText required="true" label="Max Quantity" requiredMessage="Max Quantity is required." id="maxQuantity" value="#{redemptionManagerBean.redemptionList.maxQuantity}">
                    </h:inputText>
                    <p:message for="maxQuantity" />

                    <h:outputLabel for="pointCost" style="font-weight: bold" value="Point Cost: " />
                    <h:inputText required="true" label="Point Cost" requiredMessage="Point Cost is required." id="pointCost" value="#{redemptionManagerBean.redemptionList.pointCost}">
                    </h:inputText>
                    <p:message for="pointCost" />

                    <h:outputLabel for="validFrom" style="font-weight: bold" value="Valid From: " />
                    <p:calendar value="#{redemptionManagerBean.redemptionList.validFrom}"/>
                    
                    <h:outputLabel for="blank" style="font-weight: bold" value=""/>
                    <h:outputLabel for="validUntil" style="font-weight: bold" value="Valid Until: " />
                    <p:calendar value="#{redemptionManagerBean.redemptionList.validUntil}"/>
                    
                    <h:outputLabel for="blank" style="font-weight: bold" value=""/>
                    <p:commandButton value="Visible" disabled="#{redemptionManagerBean.redemptionList.visibility}"  update="grid" actionListener="#{redemptionManagerBean.redemptionList.setVisibility(true)}" ajax="true"/>
                    <p:commandButton value="Invisible" disabled="#{!redemptionManagerBean.redemptionList.visibility}" update="grid" actionListener="#{redemptionManagerBean.redemptionList.setVisibility(false)}" ajax="true"/>
                </h:panelGrid>
                <p:commandButton id="btn" value="Create New Redemption List" update="panel" actionListener="#{redemptionManagerBean.addRedemptionList}" ajax="true" />
            </p:panel>
        </h:form>
    </h:body>
    </ui:define>
</ui:composition>
